package com.mobor.moborsvr.infra.util;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.springframework.context.ApplicationContext;

import com.mobor.moborsvr.infra.constant.MoborInfraMessages;

/**
 * Utility class to access application context (retrieve beans, etc.).
 * @author teroleg
 *
 */
public class ApplicationContextProviderUtil {

	private static final Logger logger = LogManager.getLogger(ApplicationContextProviderUtil.class.getName());
    
	private static  ApplicationContext applicationContext;

    public static void setApplicationContext(ApplicationContext appContext){
    	logger.info(MoborInfraMessages.INFRA_I_INIT_APPLICATION_CONTEXT);
    	
        applicationContext = appContext;
    }

    public static ApplicationContext getApplicationContext(){
        return applicationContext;
    }
}
